home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_HDF.idb / usr / freeware / include / hdf / netcdf.h.z / netcdf.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  15.0 KB  |  591 lines

  1. /* Generated automatically from netcdf.h.in by configure. */
  2. /*
  3.  *    Copyright 1993, University Corporation for Atmospheric Research
  4.  *
  5.  *  Permission to use, copy, modify, and distribute this software and its
  6.  * documentation for any purpose without fee is hereby granted, provided
  7.  * that the above copyright notice appear in all copies, that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of UCAR/Unidata not be used in
  10.  * advertising or publicity pertaining to distribution of the software
  11.  * without specific, written prior permission.  UCAR makes no
  12.  * representations about the suitability of this software for any purpose.
  13.  * It is provided "as is" without express or implied warranty.  It is
  14.  * provided with no support and without obligation on the part of UCAR
  15.  * Unidata, to assist in its use, correction, modification, or enhancement.
  16.  *
  17.  */
  18. /* "$Id: netcdf-irix32.h,v 1.5 1997/11/14 02:44:51 acheng Exp $" */
  19.  
  20. #ifndef _NETCDF_
  21. #define _NETCDF_
  22.  
  23. #ifdef __MWERKS__
  24. #ifndef HDF
  25. #define HDF
  26. #endif
  27. #endif /* __MWERKS__ */
  28.  
  29. /*
  30.  * The definitions ncvoid, USE_ENUM, and MAX_NC_OPEN, may need to be set
  31.  * properly for your installation.
  32.  */
  33.  
  34. /*
  35.  * Argument type in user functions (deprecated, backward compatibility)
  36.  */
  37. #ifndef UD_NO_VOID
  38. #define ncvoid    void
  39. #else
  40. /* system doesn't have void type */
  41. #define ncvoid    char
  42. #endif
  43.  
  44.  
  45. /*
  46.  *   If xdr_enum works properly on your system, you can define 
  47.  * USE_ENUM so that nc_type is an enum. 
  48.  * Otherwise, delete this definition so that the nc_type is
  49.  * an int and the valid values are #defined.
  50.  */
  51. #ifndef __MWERKS__
  52. #define USE_ENUM
  53. #endif
  54.  
  55.  
  56. /*
  57.  * The following macro is provided for backward compatibility only.  If you
  58.  * are a new user of netCDF, then you may safely ignore it.  If, however,
  59.  * you have an existing archive of netCDF files that use default
  60.  * floating-point fill values, then you should know that the definition of
  61.  * the default floating-point fill values changed with version 2.3 of the
  62.  * netCDF package.  Prior to this release, the default floating-point fill
  63.  * values were not very portable:  their correct behavior depended not only
  64.  * upon the particular platform, but also upon the compilation
  65.  * environment.  This led to the definition of new, default floating-point
  66.  * fill values that are portable across all platforms and compilation
  67.  * environments.  If you wish, however, to obtain the old, non-portable
  68.  * floating-point fill values, then the following macro should have a true
  69.  * value PRIOR TO BUILDING THE netCDF LIBRARY.
  70.  *
  71.  * Implementation details are contained in the section below on fill values.
  72.  */
  73. #define NC_OLD_FILLVALUES    0
  74.  
  75. /*
  76.  *     Fill values
  77.  * These values are stuffed into newly allocated space as appropriate.
  78.  * The hope is that one might use these to notice that a particular datum
  79.  * has not been set.
  80.  */
  81.  
  82. #define FILL_BYTE    ((char)-127)        /* Largest Negative value */
  83. #define FILL_CHAR    ((char)0)
  84. #define FILL_SHORT    ((short)-32767)
  85. #define FILL_LONG    ((long)-2147483647)
  86.  
  87. #if !NC_OLD_FILLVALUES
  88.  
  89. #   define FILL_FLOAT    9.9692099683868690e+36 /* near 15 * 2^119 */
  90. #   define FILL_DOUBLE    9.9692099683868690e+36
  91.  
  92. #else    /* NC_OLD_FILLVALUES below */
  93.  
  94. /*
  95.  * This section is provided for backward compatibility only.  Using
  96.  * XDR infinities for floating-point fill values has caused more problems
  97.  * than it has solved.  We encourage you to define your own data-specific
  98.  * fill values rather than use default ones (see `_FillValue' below).
  99.  * If, however, you *must* use default fill values, then you should use
  100.  * the above fill values rather than the ones in this section.
  101.  */
  102.  
  103. /*
  104.  * XDR_F_INFINITY is a float value whose EXTERNAL (xdr)
  105.  * represention is ieee floating infinity.
  106.  * XDR_D_INFINITY is a double value whose EXTERNAL (xdr)
  107.  * represention is ieee double floating point infinity.
  108.  * These are used as default fill values below.
  109.  *
  110.  * This section shows three techniques for setting these:
  111.  *  Direct assignment (vax, cray) - works for non IEEE machines
  112.  *        Doesn't work when IEEE machines don't allow
  113.  *      float or double constants whose values are infinity.
  114.  *  Use of a union (preferred portable method) - should work on
  115.  *      any ANSI compiler with IEEE floating point representations,
  116.  *      modulo byte order and sizeof() considerations.
  117.  *  Use of pointer puns - may work with many older compilers
  118.  *      which don't allow intialization of unions.
  119.  *      Often doesn't work with compilers which have strict
  120.  *      alignment rules.
  121.  */ 
  122.  
  123.     /* Direct assignment. All cases should be mutually exclusive */
  124.  
  125. #ifdef vax
  126. #define    XDR_D_INFINITY    1.7014118346046923e+38
  127. #define    XDR_F_INFINITY    1.70141173e+38
  128. #endif /* vax */
  129.  
  130. #ifdef cray
  131. #define    XDR_D_INFINITY    1.797693134862313000e+308
  132. #define    XDR_F_INFINITY    XDR_D_INFINITY
  133. #endif /* cray */
  134.  
  135. #ifdef notdef /* you might want to try these, on an IEEE machine */
  136. #define XDR_D_INFINITY    1.797693134862315900e+308
  137. #define XDR_F_INFINITY    3.40282357e+38
  138. #endif
  139.  
  140. #ifdef __STDC__
  141.     /* Use of a union, assumes IEEE representation and 1 byte unsigned char */
  142.  
  143. #ifndef    XDR_D_INFINITY
  144. #define USE_D_UNION
  145.      union xdr_d_union {unsigned char bb[8]; double dd;} ;
  146.      extern union xdr_d_union xdr_d_infs ;  /* instantiated in array.c */
  147. #define XDR_D_INFINITY    (xdr_d_infs.dd)
  148. #endif /* !XDR_D_INFINITY */
  149.  
  150. #ifndef    XDR_F_INFINITY
  151. #define USE_F_UNION
  152.      union xdr_f_union {unsigned char bb[4]; float ff;} ;
  153.      extern union xdr_f_union xdr_f_infs ;  /* instantiated in array.c */
  154. #define  XDR_F_INFINITY    (xdr_f_infs.ff)
  155. #endif /* !XDR_F_INFINITY */
  156.  
  157.  
  158. #else /* __STDC__ */
  159.     /* Use of a pointer pun, assumes IEEE representation, 4 byte long */
  160.  
  161. #ifndef    XDR_D_INFINITY
  162. #define USE_D_LONG_PUN
  163.      extern long xdr_d_infinity[] ;  /* instantiated in array.c */
  164. #define XDR_D_INFINITY *(double *)xdr_d_infinity
  165. #endif /* !XDR_D_INFINITY */
  166.  
  167. #ifndef    XDR_F_INFINITY
  168. #define USE_F_LONG_PUN
  169.      extern long xdr_f_infinity ;  /* instantiated in array.c */
  170. #define XDR_F_INFINITY *((float *)&xdr_f_infinity)
  171. #endif /* !XDR_F_INFINITY */
  172.  
  173. #endif /* __STDC__ */
  174.  
  175. /* End of INFINITY           section */
  176.  
  177. #define FILL_FLOAT    XDR_F_INFINITY    /* IEEE Infinity */
  178. #define FILL_DOUBLE    XDR_D_INFINITY
  179.  
  180. #endif    /* NC_OLD_FILLVALUES above */
  181.  
  182.  
  183. /*
  184.  *  masks for the struct NC flags field; passed in as 'mode' arg to
  185.  * nccreate and ncopen.
  186.  *
  187.  */
  188. #define NC_RDWR  1        /* read/write, 0 => readonly */
  189. #define NC_CREAT 2        /* in create phase, cleared by ncendef */
  190. #define NC_EXCL  4        /* on create, don't destroy existing file */
  191. #define NC_INDEF 8        /* in define mode, cleared by ncendef */
  192. #define NC_NSYNC 0x10    /* synchronise numrecs on change */
  193. #define NC_HSYNC 0x20    /* synchronise whole header on change */
  194. #define NC_NDIRTY 0x40    /* numrecs has changed */
  195. #define NC_HDIRTY 0x80  /* header info has changed */
  196. #define NC_NOFILL 0x100    /* Don't fill vars on endef and increase of record */
  197. #define NC_LINK 0x8000    /* isa link */
  198.  
  199. #define NC_FILL 0    /* argument to ncsetfill to clear NC_NOFILL */
  200.  
  201. /*
  202.  * 'mode' arguments for nccreate and ncopen
  203.  */
  204. #define NC_NOWRITE   0
  205. #define NC_WRITE     NC_RDWR
  206. #define NC_CLOBBER   (NC_INDEF | NC_CREAT | NC_RDWR)
  207. #define NC_NOCLOBBER (NC_INDEF | NC_EXCL | NC_CREAT | NC_RDWR)
  208.  
  209. /*
  210.  * 'size' argument to ncdimdef for an unlimited dimension
  211.  */
  212. #define NC_UNLIMITED 0L
  213.  
  214. /*
  215.  * attribute id to put/get a global attribute
  216.  */
  217. #define NC_GLOBAL -1
  218.  
  219. #ifndef HDF
  220. /*
  221.  * This can be as large as the maximum number of stdio streams
  222.  * you can have open on your system.
  223.  */
  224. #define MAX_NC_OPEN 32
  225.  
  226. /*
  227.  * These maximums are enforced by the interface, to facilitate writing
  228.  * applications and utilities.  However, nothing is statically allocated to
  229.  * these sizes internally.
  230.  */
  231. #define MAX_NC_DIMS 5000     /* max dimensions per file */
  232. #define MAX_NC_ATTRS 3000     /* max global or per variable attributes */
  233. #define MAX_NC_VARS 5000     /* max variables per file */
  234. #define MAX_NC_NAME 256         /* max length of a name */
  235. #define MAX_VAR_DIMS 32          /* max per variable dimensions */
  236.  
  237. /*
  238.  * Added feature. 
  239.  * If you wish a variable to use a different value than the above
  240.  * defaults, create an attribute with the same type as the variable
  241.  * and the following reserved name. The value you give the attribute
  242.  * will be used as the fill value for that variable.
  243.  */
  244. #define _FillValue    "_FillValue"
  245.  
  246. #else /* HDF */
  247.  
  248. #include "hlimits.h"  /* Hard coded constants for HDF library */
  249.  
  250. #endif /* HDF */
  251.  
  252. #ifdef USE_ENUM
  253. /*
  254.  *  The netcdf data types
  255.  */
  256. typedef enum {
  257.     NC_UNSPECIFIED, /* private */
  258.     NC_BYTE,
  259.     NC_CHAR,
  260.     NC_SHORT,
  261.     NC_LONG,
  262.     NC_FLOAT,
  263.     NC_DOUBLE,
  264.     /* private */
  265.     NC_BITFIELD,
  266.     NC_STRING,
  267.     NC_IARRAY,
  268.     NC_DIMENSION,
  269.     NC_VARIABLE,
  270.     NC_ATTRIBUTE
  271. } nc_type ;
  272. #else
  273. typedef int nc_type ;
  274. #define    NC_UNSPECIFIED 0 /* private */
  275. #define    NC_BYTE 1
  276. #define    NC_CHAR 2
  277. #define    NC_SHORT 3
  278. #define    NC_LONG 4
  279. #define    NC_FLOAT 5
  280. #define    NC_DOUBLE 6
  281.     /* private */
  282. #define    NC_BITFIELD 7
  283. #define    NC_STRING 8
  284. #define    NC_IARRAY 9
  285. #define    NC_DIMENSION 10
  286. #define    NC_VARIABLE 11
  287. #define    NC_ATTRIBUTE 12
  288. #endif
  289.  
  290.  
  291. /*
  292.  * C data types corresponding to netCDF data types:
  293.  */
  294. /* Don't use these or the C++ interface gets confused
  295. typedef char  ncchar;
  296. typedef char  ncbyte;
  297. typedef short ncshort;
  298. typedef float ncfloat;
  299. typedef double        ncdouble;
  300. */
  301.  
  302. /* 
  303.  * Variables/attributes of type NC_LONG should use the C type 'nclong'
  304.  */
  305. #if defined _CRAYMPP
  306. typedef short    nclong;
  307. #elif defined __alpha || (_MIPS_SZLONG == 64)
  308. typedef int     nclong;   
  309. #else
  310. typedef long    nclong;         /* default, compatible type */
  311. #endif
  312.  
  313.  
  314. /*
  315.  * Global netcdf error status variable
  316.  *  Initialized in error.c
  317.  */
  318. #define    NC_NOERR    0    /* No Error */
  319. #define    NC_EBADID    1    /* Not a netcdf id */
  320. #define    NC_ENFILE    2    /* Too many netcdfs open */
  321. #define    NC_EEXIST    3    /* netcdf file exists && NC_NOCLOBBER */
  322. #define    NC_EINVAL    4    /* Invalid Argument */
  323. #define    NC_EPERM    5    /* Write to read only */
  324. #define    NC_ENOTINDEFINE    6    /* Operation not allowed in data mode */
  325. #define    NC_EINDEFINE    7    /* Operation not allowed in define mode */
  326. #define    NC_EINVALCOORDS    8    /* Coordinates out of Domain */
  327. #define    NC_EMAXDIMS    9    /* MAX_NC_DIMS exceeded */
  328. #define    NC_ENAMEINUSE    10    /* String match to name in use */
  329. #define NC_ENOTATT    11    /* Attribute not found */
  330. #define    NC_EMAXATTS    12    /* MAX_NC_ATTRS exceeded */
  331. #define NC_EBADTYPE    13    /* Not a netcdf data type */
  332. #define NC_EBADDIM    14    /* Invalid dimension id */
  333. #define NC_EUNLIMPOS    15    /* NC_UNLIMITED in the wrong index */
  334. #define    NC_EMAXVARS    16    /* MAX_NC_VARS exceeded */
  335. #define NC_ENOTVAR    17    /* Variable not found */
  336. #define NC_EGLOBAL    18    /* Action prohibited on NC_GLOBAL varid */
  337. #define NC_ENOTNC    19    /* Not a netcdf file */
  338. #define NC_ESTS         20      /* In Fortran, string too short */
  339. #define NC_EMAXNAME     21      /* MAX_NC_NAME exceeded */
  340. #define NC_ENTOOL       NC_EMAXNAME   /* Backward compatibility */
  341. #define NC_EUNLIMIT     22      /* NC_UNLIMITED size already in use */
  342.  
  343. #define    NC_EXDR        32    /* */
  344. #define    NC_SYSERR    -1
  345.  
  346. extern int ncerr ;
  347.  
  348. /*
  349.  * Global options variable. Used to determine behavior of error handler.
  350.  *  Initialized in lerror.c
  351.  */
  352. #define    NC_FATAL    1
  353. #define    NC_VERBOSE    2
  354.  
  355. extern int ncopts ;    /* default is (NC_FATAL | NC_VERBOSE) */
  356.  
  357. /*
  358.  * NB: The following feature-test line is too long in order to accomodate a 
  359.  * bug in the VMS 5.3 C compiler.
  360.  */
  361. #ifndef HAVE_PROTOTYPES
  362. #   if defined(__STDC__) || defined(__GNUC__) || defined(__cplusplus) || defined(c_plusplus)
  363. #       define    HAVE_PROTOTYPES
  364. #   endif
  365. #endif
  366.  
  367. #undef PROTO
  368. #ifdef HAVE_PROTOTYPES 
  369. #   define    PROTO(x)    x
  370. #else
  371. #   define    PROTO(x)    ()
  372. #endif
  373.  
  374. #include "hdf2netcdf.h"
  375.  
  376. #ifdef __cplusplus
  377. extern "C" {
  378. #endif
  379.  
  380. extern int nccreate    PROTO((
  381.     const char*    path,
  382.     int        cmode
  383. ));
  384. extern int ncopen    PROTO((
  385.     const char*    path,
  386.     int        mode
  387. ));
  388. extern int ncredef    PROTO((
  389.     int        cdfid
  390. ));
  391. extern int ncendef    PROTO((
  392.     int        cdfid
  393. ));
  394. extern int ncclose    PROTO((
  395.     int        cdfid
  396. ));
  397. extern int ncinquire    PROTO((
  398.     int        cdfid,
  399.     int*    ndims,
  400.     int*    nvars,
  401.     int*    natts, 
  402.     int*    recdim
  403. ));
  404. extern int ncsync    PROTO((
  405.     int        cdfid
  406. ));
  407. extern int ncabort    PROTO((
  408.     int        cdfid
  409. ));
  410. extern int ncnobuf    PROTO((
  411.     int        cdfid
  412. ));
  413. extern int ncdimdef    PROTO((
  414.     int        cdfid,
  415.     const char*    name,
  416.     long    length
  417. ));
  418. extern int ncdimid    PROTO((
  419.     int        cdfid,
  420.     const char*    name
  421. ));
  422. extern int ncdiminq    PROTO((
  423.     int        cdfid,
  424.     int        dimid,
  425.     char*    name,
  426.     long*    length
  427. ));
  428. extern int ncdimrename    PROTO((
  429.     int        cdfid,
  430.     int        dimid,
  431.     const char*    name
  432. ));
  433. extern int ncvardef    PROTO((
  434.     int        cdfid,
  435.     const char*    name,
  436.     nc_type    datatype, 
  437.     int        ndims,
  438.     const int*    dim
  439. ));
  440. extern int ncvarid    PROTO((
  441.     int        cdfid,
  442.     const char*    name
  443. ));
  444. extern int ncvarinq    PROTO((
  445.     int        cdfid,
  446.     int        varid,
  447.     char*    name,
  448.     nc_type*    datatype,
  449.     int*    ndims,
  450.     int*    dim,
  451.     int*    natts
  452. ));
  453. extern int ncvarput1    PROTO((
  454.     int        cdfid,
  455.     int        varid,
  456.     const long*    coords,
  457.     const void*    value
  458. ));
  459. extern int ncvarget1    PROTO((
  460.     int        cdfid,
  461.     int        varid,
  462.     const long*    coords,
  463.     void*    value
  464. ));
  465. extern int ncvarput    PROTO((
  466.     int        cdfid,
  467.     int        varid,
  468.     const long*    start,
  469.     const long*    count, 
  470.     void*    value
  471. ));
  472. extern int ncvarget    PROTO((
  473.     int        cdfid,
  474.     int        varid,
  475.     const long*    start,
  476.     const long*    count, 
  477.     void*    value
  478. ));
  479. extern int ncvarputs    PROTO((
  480.     int        cdfid,
  481.     int        varid,
  482.     const long*    start,
  483.     const long*    count,
  484.     const long*    stride,
  485.     void*    values
  486. ));
  487. extern int ncvargets    PROTO((
  488.     int        cdfid,
  489.     int        varid,
  490.     const long*    start,
  491.     const long*    count,
  492.     const long*    stride,
  493.     void*    values
  494. ));
  495. extern int ncvarputg    PROTO((
  496.     int        cdfid,
  497.     int        varid,
  498.     const long*    start,
  499.     const long*    count,
  500.     const long*    stride,
  501.     const long*    imap,
  502.     void* values
  503. ));
  504. extern int ncvargetg    PROTO((
  505.     int        cdfid,
  506.     int        varid,
  507.     const long*    start,
  508.     const long*    count,
  509.     const long*    stride,
  510.     const long*    imap,
  511.     void*    values
  512. ));
  513. extern int ncvarrename    PROTO((
  514.     int        cdfid,
  515.     int        varid,
  516.     const char*    name
  517. ));
  518. extern int ncattput    PROTO((
  519.     int        cdfid,
  520.     int        varid,
  521.     const char*    name, 
  522.     nc_type    datatype,
  523.     int        len,
  524.     const void*    value
  525. ));
  526. extern int ncattinq    PROTO((
  527.     int        cdfid,
  528.     int        varid,
  529.     const char*    name, 
  530.     nc_type*    datatype,
  531.     int*    len
  532. ));
  533. extern int ncattget    PROTO((
  534.     int        cdfid,
  535.     int        varid,
  536.     const char*    name, 
  537.     void*    value
  538. ));
  539. extern int ncattcopy    PROTO((
  540.     int        incdf,
  541.     int        invar,
  542.     const char*    name, 
  543.     int        outcdf,
  544.     int        outvar
  545. ));
  546. extern int ncattname    PROTO((
  547.     int        cdfid,
  548.     int        varid,
  549.     int        attnum,
  550.     char*    name
  551. ));
  552. extern int ncattrename    PROTO((
  553.     int        cdfid,
  554.     int        varid,
  555.     const char*    name, 
  556.     const char*    newname
  557. ));
  558. extern int ncattdel    PROTO((
  559.     int        cdfid,
  560.     int        varid,
  561.     const char*    name
  562. ));
  563. extern int nctypelen    PROTO((
  564.     nc_type    datatype
  565. ));
  566. extern int ncsetfill    PROTO((
  567.     int        cdfid,
  568.     int        fillmode
  569. ));
  570. extern int ncrecinq        PROTO((
  571.     int        cdfid,
  572.     int*    nrecvars,
  573.     int*    recvarids,
  574.     long*    recsizes
  575. ));
  576. extern int ncrecget        PROTO((
  577.     int        cdfid,
  578.     long    recnum,
  579.     void**    datap
  580. ));
  581. extern int ncrecput        PROTO((
  582.     int        cdfid,
  583.     long    recnum,
  584.     void* * datap
  585. ));
  586. #ifdef __cplusplus
  587. }
  588. #endif
  589.  
  590. #endif /* _NETCDF_ */
  591.